﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace LHS.Win
{
    public partial class frmBangMau : Form
    {
        public frmBangMau()
        {
            InitializeComponent();
        }
        private void CreateMyListView()
        {
            this.listView1.Bounds = new Rectangle(new Point(5, 5), new Size(200, 120));
            this.listView1.BorderStyle = BorderStyle.FixedSingle;
            this.listView1.View = View.Details;
            this.listView1.LabelEdit = true;
            this.listView1.HeaderStyle = ColumnHeaderStyle.Nonclickable;
            this.listView1.AllowColumnReorder = true;
            this.listView1.FullRowSelect = true;
            this.listView1.GridLines = true;
            this.listView1.BackColor = Color.Azure;
            this.listView1.Sorting = SortOrder.Ascending;
            this.listView1.MultiSelect = false;
            ListViewItem item = new ListViewItem("Cấp 1");
            item.ForeColor = Color.Red;
            item.SubItems.Add("Trầm Trọng");
            ListViewItem item2 = new ListViewItem("Cấp 2");
            item2.ForeColor = Color.Blue;
            item2.SubItems.Add("Rất Nặng");
            ListViewItem item3 = new ListViewItem("Cấp 3");
            item3.ForeColor = Color.Purple;
            item3.SubItems.Add("Nặng");
            ListViewItem item4 = new ListViewItem("Cấp 4");
            item4.ForeColor = Color.Green;
            item4.SubItems.Add("Vừa");
            ListViewItem item5 = new ListViewItem("Cấp 5");
            item5.ForeColor = Color.Gray;
            item5.SubItems.Add("Nhẹ");
            this.listView1.Columns.Add("Mức Độ", -2, HorizontalAlignment.Center);
            this.listView1.Columns.Add(" Giải Thích ", -2, HorizontalAlignment.Center);
            this.listView1.Items.AddRange(new ListViewItem[] { item, item2, item3, item4, item5 });
            base.Controls.Add(this.listView1);
        }

        private void frmTest_Load(object sender, EventArgs e)
        {
            this.CreateMyListView();
        }

        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            if (this.listView1.SelectedItems.Count > 0)
            {
                ListViewItem item = this.listView1.SelectedItems[0];
                Class.mau = item.ForeColor.Name.ToString();
                base.Close();
            }
        }

    }
}